﻿using System.ServiceModel;
using System.IO;

namespace WP7BackupService
{
	/// <summary>
	/// Defines the Backup Service contract interface
	/// </summary>
    [ServiceContract]
    public interface IBackupService
    {
		[OperationContract]
    	string Echo(string data);

		/// <summary>
		/// Initializes the backup set, creates the directory structure if it does not exists,
		/// wipe out any existing folder if it has the same path.
		/// </summary>
		/// <param name="application">The application.</param>
		/// <param name="backupSet">The backup set.</param>
		[OperationContract]
    	void InitBackupSet(string application, string backupSet);

		/// <summary>
		/// Gets the backup set info.
		/// </summary>
		/// <param name="application">The application.</param>
		/// <param name="backupSet">The backup set.</param>
		/// <returns>A class containing the Folders and Files we can request along with their full path that
		/// will be used inside the IsolatedStorage</returns>
		[OperationContract]
    	BackupSet GetBackupSetInfo(string application, string backupSet);

    	/// <summary>
    	/// Uploads the file as a byte array.
    	/// </summary>
    	/// <param name="fileUploadInfoInfo">Application,BackupSet,Filename and content bytes</param>
    	/// <returns></returns>
    	[OperationContract]
		void UploadBytes(FileUploadInfo fileUploadInfoInfo);

		/// <summary>
		/// Uploads the file as stream.
		/// Actually this is not used because WP7 does not have support for the MessageHeaderAttribute that is requested to pass in ù
		/// additional data
		/// </summary>
		/// <param name="stream">The stream.</param>
		[OperationContract]
		void UploadStream(FileUploadStreamInfo stream);

		/// <summary>
		/// Opens a stream for downloading data.
		/// </summary>
		/// <param name="fileDownloadInfoInfo">The file download info.</param>
		/// <returns></returns>
		[OperationContract]
        Stream DownloadStream(FileDownloadInfo fileDownloadInfoInfo);
    }
}
